<script>

    // spread:展开运算符
    // 1.展开数组
    function fn1(a,b,c,d){
        console.log(a,b,c,d);
    }   

    fn1(...[1,2,3,4]);  //传递实参



    // 2.浅拷贝
    let arr1 = [1,2,3];
    let arr2 = [4,5,{name:"哈哈"}];


    let arr3 = [...arr1,...arr2];

    arr3[arr3.length-1].name = "呵呵"
    console.log(arr3);
    console.log(arr2);



    // 3.展开
    // 拷贝对象
    let obj = {name:"哈哈",age:100};
    let obj1 = {...obj};
    console.log(obj1);

    let obj2 = {...obj,name:"hello"};  //后边覆盖前边
    console.log(obj2);

</script>